home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / mtools.lha / mtools-2.0.7 / devices.c < prev    next >
C/C++ Source or Header  |  1992-09-10  |  5KB  |  176 lines

  1. /*
  2.  * Device tables.  See the Configure file for a complete description.
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include "msdos.h"
  7.  
  8. #ifdef DELL
  9. struct device devices[] = {
  10.     {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  11.     {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  12.     {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
  13.     {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  14.     {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  15.     {'C', "/dev/rdsk/dos", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  16.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  17. };
  18. #endif /* DELL */
  19.  
  20. #ifdef ISC
  21. struct device devices[] = {
  22.     {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  23.     {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  24.     {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
  25.     {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  26.     {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  27.     {'C', "/dev/rdsk/0p1", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  28.     {'D', "/usr/vpix/defaults/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  29.     {'E', "$HOME/vpix/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  30.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  31. };
  32. #endif /* ISC */
  33.  
  34. #ifdef SPARC
  35. struct device devices[] = {
  36.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  37.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  38.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  39. };
  40. #endif /* SPARC */
  41. #ifdef RT_ACIS
  42. struct device devices[] = {
  43.       {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  44.       {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  45.       {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  46. };
  47. #endif /* RT_ACIS */
  48.  
  49.  
  50. #ifdef UNIXPC
  51. #include <sys/gdioctl.h>
  52. #include <fcntl.h>
  53.  
  54. int init_unixpc();
  55.  
  56. struct device devices[] = {
  57.     {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
  58.     {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  59.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  60. };
  61.  
  62. int
  63. init_unixpc(fd, ntracks, nheads, nsect)
  64. int fd, ntracks, nheads, nsect;
  65. {
  66.     struct gdctl gdbuf;
  67.  
  68.     if (ioctl(fd, GDGETA, &gdbuf) == -1) {
  69.         ioctl(fd, GDDISMNT, &gdbuf);
  70.         return(1);
  71.     }
  72.  
  73.     gdbuf.params.cyls = ntracks;
  74.     gdbuf.params.heads = nheads;
  75.     gdbuf.params.psectrk = nsect;
  76.  
  77.     gdbuf.params.pseccyl = gdbuf.params.psectrk * gdbuf.params.heads;
  78.     gdbuf.params.flags = 1;        /* disk type flag */
  79.     gdbuf.params.step = 0;        /* step rate for controller */
  80.     gdbuf.params.sectorsz = 512;    /* sector size */
  81.  
  82.     if (ioctl(fd, GDSETA, &gdbuf) < 0) {
  83.         ioctl(fd, GDDISMNT, &gdbuf);
  84.         return(1);
  85.     }
  86.     return(0);
  87. }
  88. #endif /* UNIXPC */
  89.  
  90. #ifdef RT_ACIS
  91. struct device devices[] = {
  92.     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  93.     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  94.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  95. };
  96. #endif /* RT_ACIS */
  97.  
  98. #ifdef SUN386
  99. struct device devices[] = {
  100.     {'A', "/dev/rfdl0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  101.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  102.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  103. };
  104. #endif /* SUN386 */
  105.  
  106.   
  107. #ifdef SPARC_ODD
  108. #include <sys/types.h>
  109. #include <sun/dkio.h>
  110. #include <fcntl.h>
  111.  
  112. int init_sparc();
  113.  
  114. struct device devices[] = {
  115.     {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0},
  116.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  117. };
  118.  
  119. /*
  120.  * Stuffing back the floppy parameters into the driver allows for gems
  121.  * like 10 sector or single sided floppies from Atari ST systems.
  122.  * 
  123.  * Martin Schulz, Universite de Moncton, N.B., Canada, March 11, 1991.
  124.  */
  125.  
  126. int
  127. init_sparc(fd, ntracks, nheads, nsect)
  128. int fd, ntracks, nheads, nsect;
  129. {
  130.     struct fdk_char dkbuf;
  131.     struct dk_map   dkmap;
  132.  
  133.     if (ioctl(fd, FDKIOGCHAR, &dkbuf) != 0) {
  134.         ioctl(fd, FDKEJECT, NULL);
  135.         return(1);
  136.     }
  137.  
  138.     if (ioctl(fd, DKIOCGPART, &dkmap) != 0) {
  139.         ioctl(fd, FDKEJECT, NULL);
  140.         return(1);
  141.     }
  142.  
  143.     if (ntracks)
  144.         dkbuf.ncyl = ntracks;
  145.     if (nheads)
  146.         dkbuf.nhead = nheads;
  147.     if (nsect)
  148.         dkbuf.secptrack = nsect;
  149.  
  150.     if (ntracks && nheads && nsect )
  151.         dkmap.dkl_nblk = ntracks * nheads * nsect;
  152.  
  153.     if (ioctl(fd, FDKIOSCHAR, &dkbuf) != 0) {
  154.         ioctl(fd, FDKEJECT, NULL);
  155.         return(1);
  156.     }
  157.  
  158.     if (ioctl(fd, DKIOCSPART, &dkmap) != 0) {
  159.         ioctl(fd, FDKEJECT, NULL);
  160.         return(1);
  161.     }
  162.     return(0);
  163. }
  164. #endif /* SPARC_ODD */
  165.   
  166. #ifdef XENIX
  167. struct device devices[] = {
  168.     {'A', "/dev/fd096ds15", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  169.     {'A', "/dev/fd048ds9", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  170.     {'B', "/dev/fd1135ds18", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  171.     {'B', "/dev/fd1135ds9", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  172.     {'C', "/dev/hd0d", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  173.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  174. };
  175. #endif /* XENIX */
  176.